package com.chenyaowei.marketing.service.impl;

import java.util.List;

import com.chenyaowei.marketing.domain.CywSpuDiscount;
import com.chenyaowei.marketing.mapper.CywSpuDiscountMapper;
import com.chenyaowei.marketing.service.ICywSpuDiscountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 商品折扣Service业务层处理
 *
 * @author 陈耀威
 * @date 2023-11-28
 */
@Service
public class CywSpuDiscountServiceImpl implements ICywSpuDiscountService
{
    @Autowired
    private CywSpuDiscountMapper cywSpuDiscountMapper;

    /**
     * 查询商品折扣
     *
     * @param id 商品折扣主键
     * @return 商品折扣
     */
    @Override
    public CywSpuDiscount selectCywSpuDiscountById(Long id)
    {
        return cywSpuDiscountMapper.selectCywSpuDiscountById(id);
    }

    /**
     * 查询商品折扣列表
     *
     * @param cywSpuDiscount 商品折扣
     * @return 商品折扣
     */
    @Override
    public List<CywSpuDiscount> selectCywSpuDiscountList(CywSpuDiscount cywSpuDiscount)
    {
        return cywSpuDiscountMapper.selectCywSpuDiscountList(cywSpuDiscount);
    }

    /**
     * 新增商品折扣
     *
     * @param cywSpuDiscount 商品折扣
     * @return 结果
     */
    @Override
    public int insertCywSpuDiscount(CywSpuDiscount cywSpuDiscount)
    {
        return cywSpuDiscountMapper.insertCywSpuDiscount(cywSpuDiscount);
    }

    /**
     * 修改商品折扣
     *
     * @param cywSpuDiscount 商品折扣
     * @return 结果
     */
    @Override
    public int updateCywSpuDiscount(CywSpuDiscount cywSpuDiscount)
    {
        return cywSpuDiscountMapper.updateCywSpuDiscount(cywSpuDiscount);
    }

    /**
     * 批量删除商品折扣
     *
     * @param ids 需要删除的商品折扣主键
     * @return 结果
     */
    @Override
    public int deleteCywSpuDiscountByIds(Long[] ids)
    {
        return cywSpuDiscountMapper.deleteCywSpuDiscountByIds(ids);
    }

    /**
     * 删除商品折扣信息
     *
     * @param id 商品折扣主键
     * @return 结果
     */
    @Override
    public int deleteCywSpuDiscountById(Long id)
    {
        return cywSpuDiscountMapper.deleteCywSpuDiscountById(id);
    }

    @Override
    public List<CywSpuDiscount> selectListBySpuIds(List<Long> spuIds) {
        return cywSpuDiscountMapper.selectListBySpuIds(spuIds);
    }
}
